package com.eascs.admin.o2o.finance.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.eascs.admin.o2o.finance.dao.O2oFinanceFlowDao;
import com.eascs.admin.o2o.finance.entity.O2oFinanceFlowEntity;

@Service
public class O2oFinanceFlowService {

	@Autowired
	O2oFinanceFlowDao financeFlowDao;
	
	@Transactional(transactionManager = "o2oTransactionManager")
	public int insert(O2oFinanceFlowEntity entity){
		return financeFlowDao.insert(entity);
	}
	
	@Transactional(transactionManager = "o2oTransactionManager")
	public int update(O2oFinanceFlowEntity entity){
		return financeFlowDao.updateById(entity);
	}
	
	public O2oFinanceFlowEntity getByLoanApplyno(String loanapplyNo){
		String sql = "SELECT * FROM O2O_FINANCE_FLOW_STATUS WHERE LOANAPPLYNO=? ";
		return financeFlowDao.findEntity(sql, O2oFinanceFlowEntity.class, loanapplyNo);
	}
}
